#include <iostream>
#include <time.h>
#include "IMaxHeap.h"
#include "IStack.h"
#include "IQueue.h"
#include "IMap.h"
#include "ISet.h"

#define NUM_LENGTH 10

int campara_int(int a, int b)
{
	return a < b ? -1 : (a == b ? 0 : 1);
}

int main()
{
	srand((unsigned int)time(0));

//+++++++++++++++++++++++++++++++++++++++++++++++++++++maxHeap
	IDC::IMaxHeap<int>* maxHeap = new IDC::IMaxHeap<int>(8, campara_int);

	for (int i = 0; i < NUM_LENGTH; ++i)
	{
		int n = rand() % 100;
		maxHeap->Push(n);
	}

	std::cout<<"maxHeap : length:"<<maxHeap->Length()<<std::endl;

	IDC::IMaxHeap<int> maxHeapCopy = *maxHeap;
	maxHeap->Clear();

	std::cout<<"maxHeap : length:"<<maxHeap->Length()<<std::endl;

	int tmp1 = 0;
	for (int i = 0; i < NUM_LENGTH; ++i)
	{
		maxHeapCopy.Pop(&tmp1);
		std::cout<<tmp1<<std::endl;
	}

//+++++++++++++++++++++++++++++++++++++++++++++++++++++stack
	IDC::IStack<int>* stack = new IDC::IStack<int>(8);
	for (int i = 0; i < NUM_LENGTH; ++i)
		stack->Push(i);

	std::cout<<"stack : length :"<<stack->Length()<<std::endl;

	IDC::IStack<int> stackCopy = *stack;
	stack->Clear();

	std::cout<<"stack : length :"<<stack->Length()<<std::endl;

	int tmp2 = 0;
	for (int i = 0; i < NUM_LENGTH; ++i)
	{
		stackCopy.Pop(&tmp2);
		std::cout<<tmp2<<std::endl;
	}

//+++++++++++++++++++++++++++++++++++++++++++++++++++++queue
	IDC::IQueue<int>* queue = new IDC::IQueue<int>(8);
	for (int i = 0; i < NUM_LENGTH; ++i)
		queue->Push(i);

	std::cout<<"queue : length :"<<queue->Length()<<std::endl;

	IDC::IQueue<int> queueCopy = *queue;
	queue->Clear();

	std::cout<<"queue : length :"<<queue->Length()<<std::endl;

	int tmp3 = 0;
	for (int i = 0; i < NUM_LENGTH; ++i)
	{
		queueCopy.Pop(&tmp3);
		std::cout<<tmp3<<std::endl;
	}

//+++++++++++++++++++++++++++++++++++++++++++++++++++++map
	IDC::IMap<int, char>* map = new IDC::IMap<int, char>(8, campara_int);
	for (int i = 0; i < NUM_LENGTH; ++i)
		map->Push(i, 'a' + i);

	std::cout<<"map : length :"<<map->Length()<<std::endl;

	IDC::IMap<int, char> mapCopy = *map;
	map->Clear();

	std::cout<<"map : length :"<<map->Length()<<std::endl;

	char tmp4 = 0;
	for (int i = 0; i < NUM_LENGTH; ++i)
	{
		mapCopy.Top(i, &tmp4);
		std::cout<<tmp4<<std::endl;
	}

//+++++++++++++++++++++++++++++++++++++++++++++++++++++set
	IDC::ISet<int>* set = new IDC::ISet<int>(8, campara_int);
	for (int i = 0; i < NUM_LENGTH; ++i)
		set->Push(i);

	std::cout<<"set : length :"<<set->Length()<<std::endl;

	IDC::ISet<int> setCopy = *set;
	set->Clear();

	std::cout<<"set : length :"<<set->Length()<<std::endl;

	int tmp5 = 0;
	for (int i = 0; i < NUM_LENGTH; ++i)
	{
		setCopy.Pop(&tmp5);
		std::cout<<tmp5<<std::endl;
	}
	system("pause");
	return 1;
}